home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Scope / Scope Disk #142 (199x)(Scope PD)(US)[WB].zip / Scope Disk #142 (199x)(Scope PD)(US)[WB].adf / LoadImage / StringAsm.asm < prev    next >
Assembly Source File  |  1990-07-30  |  2KB  |  59 lines

  1. * $Revision Header * Header built automatically - do not edit! *************
  2. *
  3. *    (C) Copyright 1990 by MXM
  4. *
  5. *    Name .....: StringAsm.asm
  6. *    Created ..: Friday 13-Apr-90 15:56
  7. *    Revision .: 0
  8. *
  9. *    Date            Author          Comment
  10. *    =========       ========        ====================
  11. *    13-Apr-90       Olsen           Created this file!
  12. *
  13. * $Revision Header *********************************************************
  14. *
  15. *    This file contains the assembly language source code for
  16. *    the string routines employed by rexxhost.library.
  17. *
  18. ****************************************************************************
  19.  
  20.         SECTION    StringAsm,CODE
  21.  
  22.         XDEF    _StrLen
  23.         XDEF    _StrCpy
  24.         XDEF    _StrNCpy
  25.  
  26. *----------------------------------------------------------------------------
  27.  
  28. _StrLen:    MOVEQ    #0,D0        ; Reset counter
  29. 1$        TST.B    (A0)+        ; Test for 0
  30.         BEQ.S    2$        ; End of string
  31.         ADDQ    #1,D0        ; Increment length counter
  32.         BRA.S    1$        ; Test again...
  33. 2$        RTS
  34.  
  35. *----------------------------------------------------------------------------
  36.  
  37. _StrCpy:    TST.B    (A1)        ; Empty string?
  38.         BEQ.S    1$
  39.         MOVE.B    (A1)+,(A0)+    ; Copy character
  40.         BRA.S    _StrCpy        ; Check for 0
  41. 1$        MOVE.B    #0,(A0)        ; Null-termination
  42.         RTS
  43.  
  44. *----------------------------------------------------------------------------
  45.  
  46. _StrNCpy:    TST.L    D0        ; Legal length?
  47.         BEQ.S    2$
  48.  
  49. 1$        MOVE.B    (A1)+,(A0)+    ; Copy character
  50.         DBRA    D0,1$        ; Decrement length counter
  51.  
  52. 2$        MOVE.L    D0,A1        ; Null-termination
  53.         MOVE.B    #0,0(A0,A1)
  54.         RTS
  55.  
  56. *----------------------------------------------------------------------------
  57.  
  58.         END
  59.